* ##############################################
* 2020 September SURVEY SETUP
* ##############################################

*Load the data
use  "Data/replication.dta"

*Recode Variables

*gender
codebook qS1, tab (50)
recode qS1 (1=1 "male") (2=0 "female"), gen (gender)

*age
codebook qS2, tab (50) 
gen age=qS2

*education
codebook qS3, tab (50) 
gen education = qS3


*past vote
codebook qd1b, tab (50)
recode qd1b (4=1) (else=0), gen (putin_voter)

recode qd1b (4=1) (1/3=0) (5/99=0) (.=2), gen (vote_cast) /*1:Putin, 0: Other, 2:Nonvoter*/

*Moscow/ St Petersburg 
recode qOBL (87/88=1) (else=0), gen (msp)

*Economic status 
recode qd8 (1/2=0) (3/6=1), gen (econ_status)

*Experimental groups indicator
codebook qVAR, tab (50) 

recode qVAR (1/4=0 "authorised") (5/8=1 "unauthorised"), gen (unauthorised)
 
recode qVAR (1/2=0 "peaceful") (3/4=1 "violent") (5/6=0 "peaceful") (7/8=1 "violent"), gen (violent) 

recode qVAR (1=0 "no arrest") (2=1 "arrest") (3=0 "no arrest") (4=1 "arrest") (5=0 "no arrest") (6=1 "arrest") (7=0 "no arrest") (8=1 "arrest"), gen (arrest) 

recode qVAR (1=1 "auth_peace") (2=1 "auth_peace") (3=2 "auth_violent")  (4=2 "auth_violent")  (5=3 "unauth_peace") (6=3 "unauth_peace") (7=4 "unauth_violent") (8=4 "unauth_violent"), gen (added_tactics) 

*Authorities support 
codebook qq1A, tab (50) 
recode qq1A (1=1) (2=2) (88/99=3) (3=4) (4=5), gen (supp_auth) 
recode qq1A (1=1) (2=2) (88/99=.) (3=3) (4=4), gen (supp_auth2) 

*Protester support 
codebook qq1B, tab (50) 
recode qq1B (1=1) (2=2) (88/99=3) (3=4) (4=5), gen (supp_dem) 
recode qq1B (1=1) (2=2) (88/99=.) (3=3) (4=4), gen (supp_dem2) 

recode qq1B (1=0) (2=0) (88/99=0) (3=1) (4=1), gen (supp_dem3) 
recode qq1B (1=0) (2=0) (88/99=.) (3=1) (4=1), gen (supp_dem4) 
recode qq1B (88/99=1) (else=0), gen (missing)

*Police support  
codebook qq1C, tab (50)
recode qq1C (1=1) (2=2) (88/99=3) (3=4) (4=5), gen (supp_arrest) 
recode qq1C (1=1) (2=2) (88/99=.) (3=3) (4=4), gen (supp_arrest2) 

*Difference in support authorities-protesters
gen diffsupp=supp_auth-supp_dem
gen diffsupp2=supp_auth2-supp_dem2

*Protest Support
codebook qq2, tab (50) 
recode qq2 (1/2=1 "support") (3/9=0), gen (part_dummy)

codebook qq2, tab (50) 
recode qq2 (1/2=1 "support") (3/4=0) (9=.), gen (part_dummy2)

codebook qq2, tab (50) 
recode qq2 (1=1) (2=2) (3=3) (4=4) (9=.), gen (part_dummy3)


*Normative support for the law
recode qI3 (1=1) (2=2) (3=3) (88/99=3) (4=4) (5=5), gen (legal_concerns)
codebook legal_concerns, tab (50) 

*Support for unauthorized tactics 
codebook q19b, tab (50) 
recode q19b (1/2=1 "acceptable") (3/99=0 "unacceptable"), gen (unauth_acc)

*Opposition approval 
codebook qn1*, compact
recode qn1a (1=1) (2/9=0), gen (approve_zyug)
recode qn1b (1=1) (2/9=0), gen (approve_zhir)
recode qn1c (1=1) (2/9=0), gen (approve_nav)
codebook approve*, compact

gen approve_opposition=. 
replace approve_opposition=1 if approve_nav==1 | approve_zhir==1 | approve_zyug==1
tab approve_opposition 

recode approve_opposition (1=1) (.=0), gen (app_opp)
tab app_opp

